package com.jeecg.client;

import com.jeecg.model.Person;
import com.jeecg.mongo.MiniMongo;

public class TestMongo {
	
	private MiniMongo miniMongo = new MiniMongo();
	public static void main(String[] args){
		//创建数据库
//		miniMongo.createDataBase("foobar", "persons");
		//插入数据
//		Person person1 = new Person("Jack","USA",true,23);
//		miniMongo.insertData("foobar", "persons", person1);
		//修改数据
		Person person2 = new Person();
		person2.set_id("5530243b-ec14-44c7-988a-d532eeabc15f");
//		person2.setName("Tom");
//		miniMongo.updateData("foobar", "persons", person2);
		//查询数据
//		miniMongo.queryAllData("foobar", "persons");
//		miniMongo.queryDataById("foobar", "persons", "34b69bba-0500-4c6e-9fa9-ac74c2c4cbc9");
		//删除数据
//		miniMongo.deleteData("foobar", "persons",person2);
	}

	public void testCreateDatabase(){
		miniMongo.createDataBase("foobar", "persons");
	}
	public void testInsertData(){
		Person person1 = new Person("Jack","USA",true,23);
		miniMongo.insertData("foobar", "persons", person1);
	}
	public void testUpdateData(){
		Person person2 = new Person();
		person2.set_id("5530243b-ec14-44c7-988a-d532eeabc15f");
	}
	public void testQueryAllData(){
		miniMongo.queryAllData("foobar", "persons");
		
	}
	public void testQueryDataById(){
		miniMongo.queryDataById("foobar", "persons", "34b69bba-0500-4c6e-9fa9-ac74c2c4cbc9");
		
	}
	public void TestDeleteData(){
		Person person3 = new Person();
		person3.set_id("5530243b-ec14-44c7-988a-d532eeabc15f");
		miniMongo.deleteData("foobar", "persons",person3);
	}
	
}
